<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chebyshev Polynomials</title>
<link rel="stylesheet" href="../../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Math Toolkit 3.3.0">
<link rel="up" href="../sf_poly.html" title="Polynomials">
<link rel="prev" href="hermite.html" title="Hermite Polynomials">
<link rel="next" href="sph_harm.html" title="Spherical Harmonics">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="hermite.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_poly.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sph_harm.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="math_toolkit.sf_poly.chebyshev"></a><a class="link" href="chebyshev.html" title="Chebyshev Polynomials">Chebyshev Polynomials</a>
</h3></div></div></div>
<h5>
<a name="math_toolkit.sf_poly.chebyshev.h0"></a>
        <span class="phrase"><a name="math_toolkit.sf_poly.chebyshev.synopsis"></a></span><a class="link" href="chebyshev.html#math_toolkit.sf_poly.chebyshev.synopsis">Synopsis</a>
      </h5>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">chebyshev</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Real2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Real3</span><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_next</span><span class="special">(</span><span class="identifier">Real1</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">Real2</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">Tn</span><span class="special">,</span> <span class="identifier">Real3</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">Tn_1</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_t</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 21. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_t</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 21. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_u</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 21. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_u</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 21. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_t_prime</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Real2</span><span class="special">&gt;</span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">chebyshev_clenshaw_recurrence</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Real1</span><span class="special">*</span> <span class="keyword">const</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">length</span><span class="special">,</span> <span class="identifier">Real2</span> <span class="identifier">x</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Real</span><span class="special">&gt;</span>
<span class="identifier">Real</span> <span class="identifier">chebyshev_clenshaw_recurrence</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Real</span><span class="special">*</span> <span class="keyword">const</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">length</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x</span><span class="special">);</span>

<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
<p>
        <span class="emphasis"><em>"Real analysts cannot do without Fourier, complex analysts
        cannot do without Laurent, and numerical analysts cannot do without Chebyshev"</em></span>
        --Lloyd N. Trefethen
      </p>
<p>
        The Chebyshev polynomials of the first kind are defined by the recurrence
        <span class="emphasis"><em>T</em></span><sub>n+1</sub>(<span class="emphasis"><em>x</em></span>) := <span class="emphasis"><em>2xT</em></span><sub>n</sub>(<span class="emphasis"><em>x</em></span>)
        - <span class="emphasis"><em>T</em></span><sub>n-1</sub>(<span class="emphasis"><em>x</em></span>), <span class="emphasis"><em>n &gt; 0</em></span>,
        where <span class="emphasis"><em>T</em></span><sub>0</sub>(<span class="emphasis"><em>x</em></span>) := 1 and <span class="emphasis"><em>T</em></span><sub>1</sub>(<span class="emphasis"><em>x</em></span>)
        := <span class="emphasis"><em>x</em></span>. These can be calculated in Boost using the following
        simple code
      </p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0.5</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">T12</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">chebyshev_t</span><span class="special">(</span><span class="number">12</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span>
</pre>
<p>
        Calculation of derivatives is also straightforward:
      </p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">T12_prime</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">chebyshev_t_prime</span><span class="special">(</span><span class="number">12</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span>
</pre>
<p>
        The complexity of evaluation of the <span class="emphasis"><em>n</em></span>-th Chebyshev polynomial
        by these functions is linear. So they are unsuitable for use in calculation
        of (say) a Chebyshev series, as a sum of linear scaling functions scales
        quadratically. Though there are very sophisticated algorithms for the evaluation
        of Chebyshev series, a linear time algorithm is presented below:
      </p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0.5</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">c</span><span class="special">{</span><span class="number">14.2</span><span class="special">,</span> <span class="special">-</span><span class="number">13.7</span><span class="special">,</span> <span class="number">82.3</span><span class="special">,</span> <span class="number">96</span><span class="special">};</span>
<span class="keyword">double</span> <span class="identifier">T0</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">T1</span> <span class="special">=</span> <span class="identifier">x</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">c</span><span class="special">[</span><span class="number">0</span><span class="special">]*</span><span class="identifier">T0</span><span class="special">/</span><span class="number">2</span><span class="special">;</span>
<span class="keyword">unsigned</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
<span class="keyword">while</span><span class="special">(</span><span class="identifier">l</span> <span class="special">&lt;</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
<span class="special">{</span>
   <span class="identifier">f</span> <span class="special">+=</span> <span class="identifier">c</span><span class="special">[</span><span class="identifier">l</span><span class="special">]*</span><span class="identifier">T1</span><span class="special">;</span>
   <span class="identifier">std</span><span class="special">::</span><span class="identifier">swap</span><span class="special">(</span><span class="identifier">T0</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">);</span>
   <span class="identifier">T1</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">chebyshev_next</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">T0</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">);</span>
   <span class="special">++</span><span class="identifier">l</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
        This uses the <code class="computeroutput"><span class="identifier">chebyshev_next</span></code>
        function to evaluate each term of the Chebyshev series in constant time.
        However, this naive algorithm has a catastrophic loss of precision as <span class="emphasis"><em>x</em></span>
        approaches 1. A method to mitigate this way given by <a href="http://www.ams.org/journals/mcom/1955-09-051/S0025-5718-1955-0071856-0/S0025-5718-1955-0071856-0.pdf" target="_top">Clenshaw</a>,
        and is implemented in boost as
      </p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0.5</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">c</span><span class="special">{</span><span class="number">14.2</span><span class="special">,</span> <span class="special">-</span><span class="number">13.7</span><span class="special">,</span> <span class="number">82.3</span><span class="special">,</span> <span class="number">96</span><span class="special">};</span>
<span class="keyword">double</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">chebyshev_clenshaw_recurrence</span><span class="special">(</span><span class="identifier">c</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">size</span><span class="special">(),</span> <span class="identifier">x</span><span class="special">);</span>
</pre>
<p>
        N.B.: There is factor of <span class="emphasis"><em>2</em></span> difference in our definition
        of the first coefficient in the Chebyshev series from Clenshaw's original
        work. This is because two traditions exist in notation for the Chebyshev
        series expansion,
      </p>
<p>
        <span class="inlinemediaobject"><object type="image/svg+xml" data="../../../graphs/chebyshev_convention_1.svg" width="149" height="54"></object></span>
      </p>
<p>
        and
      </p>
<p>
        <span class="inlinemediaobject"><object type="image/svg+xml" data="../../../graphs/chebyshev_convention_2.svg" width="193" height="54"></object></span>
      </p>
<p>
        <span class="emphasis"><em><span class="bold"><strong>boost math always uses the second convention,
        with the factor of 1/2 on the first coefficient.</strong></span></em></span>
      </p>
<p>
        Another common use case is when the polynomial must be evaluated on some
        interval [<span class="emphasis"><em>a</em></span>, <span class="emphasis"><em>b</em></span>]. The translation
        to the interval [-1, 1] causes a few accuracy problems and also gives us
        some opportunities. For this case, we use <a href="https://doi.org/10.1093/imamat/20.3.379" target="_top">Reinch's
        modification</a> to the Clenshaw recurrence, which is also discussed
        <a href="https://archive.siam.org/books/ot99/OT99SampleChapter.pdf" target="_top">here</a>.
        The usage is as follows:
      </p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">9</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">7</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">12</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">c</span><span class="special">{</span><span class="number">14.2</span><span class="special">,</span> <span class="special">-</span><span class="number">13.7</span><span class="special">,</span> <span class="number">82.3</span><span class="special">,</span> <span class="number">96</span><span class="special">};</span>
<span class="keyword">double</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">chebyshev_clenshaw_recurrence</span><span class="special">(</span><span class="identifier">c</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">size</span><span class="special">(),</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span>
</pre>
<p>
        Chebyshev polynomials of the second kind can be evaluated via <code class="computeroutput"><span class="identifier">chebyshev_u</span></code>:
      </p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="special">-</span><span class="number">0.23</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">U1</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">chebyshev_u</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span>
</pre>
<p>
        The evaluation of Chebyshev polynomials by a three-term recurrence is known
        to be <a href="https://link.springer.com/article/10.1007/s11075-014-9925-x" target="_top">mixed
        forward-backward stable</a> for <span class="emphasis"><em>x</em></span> ∊ [-1,
        1]. However, the author does not know of a similar result for <span class="emphasis"><em>x</em></span>
        outside [-1, 1]. For this reason, evaluation of Chebyshev polynomials outside
        of [-1, 1] is strongly discouraged. That said, small rounding errors in the
        course of a computation will often lead to this situation, and termination
        of the computation due to these small problems is very discouraging. For
        this reason, <code class="computeroutput"><span class="identifier">chebyshev_t</span></code>
        and <code class="computeroutput"><span class="identifier">chebyshev_u</span></code> have code
        paths for <span class="emphasis"><em>x &gt; 1</em></span> and <span class="emphasis"><em>x &lt; -1</em></span>
        which do not use three-term recurrences. These code paths are <span class="emphasis"><em>much
        slower</em></span>, and should be avoided if at all possible.
      </p>
<p>
        Evaluation of a Chebyshev series is relatively simple. The real challenge
        is <span class="emphasis"><em>generation</em></span> of the Chebyshev series. For this purpose,
        boost provides a <span class="emphasis"><em>Chebyshev transform</em></span>, a projection operator
        which projects a function onto a finite-dimensional span of Chebyshev polynomials.
        But before we discuss the API, let's analyze why we might want to project
        a function onto a span of Chebyshev polynomials.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            We want a numerically stable way to evaluate the function's derivative.
          </li>
<li class="listitem">
            Our function is expensive to evaluate, and we wish to find a less expensive
            way to estimate its value. An example are the standard library transcendental
            functions: These functions are guaranteed to evaluate to within 1 ulp
            of the exact value, but often this accuracy is not needed. A projection
            onto the Chebyshev polynomials with a low accuracy requirement can vastly
            accelerate the computation of these functions.
          </li>
<li class="listitem">
            We wish to numerically integrate the function.
          </li>
</ul></div>
<p>
        The API is given below.
      </p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">chebyshev_transform</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">chebyshev_transform</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span>
    <span class="identifier">chebyshev_transform</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">F</span><span class="special">&amp;</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">tol</span><span class="special">=</span><span class="number">500</span><span class="special">*</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;::</span><span class="identifier">epsilon</span><span class="special">());</span>

    <span class="identifier">Real</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span>

    <span class="identifier">Real</span> <span class="identifier">integrate</span><span class="special">()</span> <span class="keyword">const</span>

    <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;&amp;</span> <span class="identifier">coefficients</span><span class="special">()</span> <span class="keyword">const</span>

    <span class="identifier">Real</span> <span class="identifier">prime</span><span class="special">(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">};</span>

<span class="special">}}//</span> <span class="identifier">end</span> <span class="identifier">namespaces</span>
</pre>
<p>
        The Chebyshev transform takes a function <span class="emphasis"><em>f</em></span> and returns
        a <span class="emphasis"><em>near-minimax</em></span> approximation to <span class="emphasis"><em>f</em></span>
        in terms of Chebyshev polynomials. By <span class="emphasis"><em>near-minimax</em></span>,
        we mean that the resulting Chebyshev polynomial is "very close"
        the polynomial <span class="emphasis"><em>p</em></span><sub>n</sub>  which minimizes the uniform norm of
        <span class="emphasis"><em>f</em></span> - <span class="emphasis"><em>p</em></span><sub>n</sub>. The notion of "very
        close" can be made rigorous; see Trefethen's "Approximation Theory
        and Approximation Practice" for details.
      </p>
<p>
        The Chebyshev transform works by creating a vector of values by evaluating
        the input function at the Chebyshev points, and then performing a discrete
        cosine transform on the resulting vector. In order to do this efficiently,
        we have used <a href="http://www.fftw.org/" target="_top">FFTW3</a>. So to compile,
        you must have <code class="computeroutput"><span class="identifier">FFTW3</span></code> installed,
        and link with <code class="computeroutput"><span class="special">-</span><span class="identifier">lfftw3</span></code>
        for double precision, <code class="computeroutput"><span class="special">-</span><span class="identifier">lfftw3f</span></code>
        for float precision, <code class="computeroutput"><span class="special">-</span><span class="identifier">lfftw3l</span></code>
        for long double precision, and <code class="computeroutput"><span class="special">-</span><span class="identifier">lfftw3q</span></code> for quad (<code class="computeroutput"><span class="identifier">__float128</span></code>)
        precision. After the coefficients of the Chebyshev series are known, the
        routine goes back through them and filters out all the coefficients whose
        absolute ratio to the largest coefficient are less than the tolerance requested
        in the constructor.
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland,
      Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno
      Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde,
      Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle
      Walker and Xiaogang Zhang<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="hermite.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_poly.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sph_harm.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
